<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>获奖信息</title>
    <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/bootstrap-table.min.css">
    <script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/bootstrap-table.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/locale/bootstrap-table-zh-CN.min.js"></script>
</head>
<body>
<div class="col-md-6">
<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title">Panel title</h3>
  </div>
  <div class="panel-body">
        <table id="table"></table>
  </div>
</div>
</div>

<div>
    <form method=post enctype=multipart/form-data>
         <input type=file name=file>
         <input type=submit value=上传>
    </form>
</div>

<button id="bttest">testappperson</button>




<script type="text/javascript">
    $('#table').bootstrapTable({
        url: '/gettabledata',
        columns: [{
            field: 'id',
            title: '编号'
        }, {
            field: 'name',
            title: '姓名'
        }, {
            field: 'department',
            title: '公司'
        },{
            field: 'lottery',
            title: '获奖信息'
        }]
    });
    $("#bttest").click(function () {
        $.ajax({
            url: '/getallperson',
            method: 'GET'
        }).done(function (response) {
            if (response.code === 0) {
                var dataarray = JSON.parse(response.data);
                for(var i = 0 ; i<dataarray.length; i++){
                    dataarray[i].lottery = "";
                }

                console.log(dataarray);

                $.ajax({
                    url: '/saveallperson',
                    method: 'POST',
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    data: JSON.stringify(dataarray)
                }).done(function (response) {
                    if (response.code === 0) {
                    } else {
                    }
                });

            } else {
            }
        });

    })
</script>
</body>


</html>